﻿using Microsoft.Extensions.DependencyInjection;

using zijian666.Core.Abstractions;

namespace zijian666.DI.Features;

/// <summary>
/// 表示支持键值服务特性
/// </summary>
public interface IKeyedServiceFeature : IFeature
{
    ServiceDescriptor CreateKeyedServiceDescriptor(Type serviceType,
            object? serviceKey,
            Type implementationType,
            ServiceLifetime lifetime);

    ServiceDescriptor CreateKeyedServiceDescriptor(Type serviceType,
            object? serviceKey,
            Func<IServiceProvider, object?, object> factory,
            ServiceLifetime lifetime);

    object? GetKeyedService(IServiceProvider provider, Type implementationType, object? serviceKey);
}
